Chain rule with trig functions